<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<fieldset>
	<legend>
		<strong>Register User</strong>
	</legend>
	<form:form id="form1" method="post" action="/ChitFund/admin/registerUser.htm">
			<table>
				<tr>
					<td><strong><label>User Name:</label></strong></td>
					<td><form:input path="username" id="username" /></td>
				</tr>
				<tr>
					<td><strong><label>Password</label></strong></td>
					<td><form:password path="password" id="password" /></td>
				</tr>
				<tr>
					<td><strong><label>Authority</label></strong></td>
					<td><select name="grantedAuthority" class="grantedAuthority">
							<option selected="selected" value="null">select Authority</option>
							<option value="ROLE_USER">User</option>
							<option value="ROLE_ADMIN">Admin</option>
					</select></td>
				</tr>
				
				<tr class="branch">
					<td><form:label path="branchName">Branch</form:label></td>
					<td><select name="branchName" id="branchName">
							<option selected="selected" value="null">select Branch</option>
							<c:forEach var="branch" items="${branches}">
								<option value="${branch.branchName}">
									<c:out value="${branch.branchName}" />
								</option>
							</c:forEach>
					</select></td>
				</tr>
				<tr>
					<td>
						<div class="form-btn">
							<input name="Save" id="save" type="submit" value="Save"
								class="btn btn-large"> <input name="Clear" id="clear"
								type="reset" value="Clear" class="btn btn-large">
						</div>
					</td>
				</tr>
			</table>
		</form:form>
</fieldset>
<script type="text/javascript" src="resources/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
		$(document).ready(function() {
		$('.grantedAuthority').change(function() {	
		var id = $('.grantedAuthority option:selected').text();
		switch(id)
		{
		case "select Authority":$('.branch').show();break;
		case "User":$('.branch').show();break;
		case "Admin":$('.branch').hide();break;
		}
		});
		});
</script>
																